#/bin/bash
    echo " Replacing yum aliyun source..."
    release=$(cat /etc/redhat-release | awk '{ print $4 }' | cut -c1)
    echo "This is red hat $release version"
    mv /etc/yum.repo.d/ /etc/yum.repo.d.bak
    mkdri /etc/yum.repo.d
    curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-$release.repo

    echo "install epel source"
    yum install -y epel-release

    echo " Replacing epel aliyun source..."
    cp /etc/yum.repo.d/epel.repo /etc/yum.repo.d/epel.repo.bak
    sed -i "download.fedoraproject.org/pub/cmirrors.aliyun.com/epel/$release" /etc/yum.repos.d/epel.repo
    sed -i 'metalink/c#metalink' /etc/yum.repos.d/epel.repo

    yum clean all
    yum makecache
